﻿using CuteSprite.Eme.Data.Settlement;
using CuteSprite.Eme.UI.Utils;
using HmFramework.Components;
using System;
using System.Windows.Forms;

namespace CuteSprite.Eme.UI.Settlement
{
  public partial class FrmBsdBillingPriceAdmin : EmeCommonAdminForm
  {
    #region -- 属性 --



    #endregion

    #region -- 构造 --

    public FrmBsdBillingPriceAdmin()
    {
      EntityDataSource = BsdEntityHelper.ModelSettlement;
      EntityDataTable = BsdEntityHelper.SSTableBillingPrice;

      InitForm();
    }

    #endregion

    #region -- 控件初始化 --

    private ButtonX btnBillingSolutionManagement;

    protected override void InitComponent()
    {
      base.InitComponent();

      btnBillingSolutionManagement = CreateButton("btnBillingSolutionManagement", "管理计费价格明细表", 8);
      btnBillingSolutionManagement.Location = new System.Drawing.Point(431, 7);
      btnBillingSolutionManagement.Size = new System.Drawing.Size(120, 23);
      btnBillingSolutionManagement.Click += new EventHandler(btnBillingPriceDetailManagement_Click);

      ToolbarPanelControl.Controls.Add(btnBillingSolutionManagement);
    }

    #endregion

    #region -- 管理计费方案 --

    private void btnBillingPriceDetailManagement_Click(object sender, EventArgs e)
    {
      var billingprice = SelectedEntity as BillingPrice;
      if (billingprice == null)
      {
        MessageBoxEx.Show("请选择需要管理的计费价格！", "计费价格", MessageBoxButtons.OK, MessageBoxIcon.Warning);
      }
      else
      {
        // 判断公布价方案代码是否为空，如果为空从服务器取代码
        var frm = new FrmBillingPriceDetailAdmin(billingprice.ID);
          var result = frm.ShowDialog(this);
          frm.Close();
      }
    }

    #endregion
  }
}